package com.fs.service;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.mapper.DistrictMapper;
import com.fs.pojo.District;
import com.fs.pojo.UserAddr;
import com.fs.service.DistrictService;
import com.fs.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
public class DistrictServiceImpl extends ServiceImpl<DistrictMapper, District> implements DistrictService {

    @Autowired
    private RedisTemplate redisTemplate;

    @Cacheable("addrId")
    @Override
    public ResultVO getDistrict(String addrId) {
        ListOperations lo = redisTemplate.opsForList();
        List<District> list = lo.range("key-" + addrId, 0, -1);

        return ResultVO.success(list);
    }

}
